package com.tmt.helper;

import java.math.BigDecimal;

public class BigDecimalHelper {

    /**
     * 判断两个数值范围是否相交
     * @param array1
     * @param array2
     * @return
     */
    public static boolean isIntersect(BigDecimal[] array1, BigDecimal[] array2){
        return  array1[0].compareTo(array2[0]) >= 0 && array1[1].compareTo(array2[0]) <=0
                || array1[0].compareTo(array2[1]) >= 0 && array1[1].compareTo(array2[1]) <=0
                || array2[0].compareTo(array1[0]) >= 0 && array2[1].compareTo(array1[0]) <=0
                || array2[0].compareTo(array1[1]) >= 0 && array2[1].compareTo(array1[1]) <=0;
    }
}
